package com.greenantmall.activity;

import java.util.List;

import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.avos.avoscloud.AVException;
import com.avos.avoscloud.AVUser;
import com.greenantmall.AntHomeApplication;
import com.greenantmall.R;
import com.greenantmall.activity.fragment.TabFragmentExpress;
import com.greenantmall.activity.fragment.TabFragmentHome;
import com.greenantmall.activity.fragment.TabFragmentStore;
import com.greenantmall.bean.ServerSection;
import com.greenantmall.bean.ServiePhone;
import com.greenantmall.bean.ShoppingCart;
import com.greenantmall.bean.StoreInfo;
import com.greenantmall.service.RetrieveDataAsyn;
import com.greenantmall.service.RetrieveDataListener;
import com.greenantmall.utils.Const;
import com.greenantmall.utils.UtilTools;
import com.greenantmall.version.DownloadManager;
import com.greenantmall.view.SlidingMenu;
import com.greenantmall.view.SwitchAreaPromptDialog;
import com.greenantmall.view.SwitchAreaPromptDialog.BtnClickListener;
import com.handmark.pulltorefresh.library.internal.Utils;
import com.lsarah.utils.SystemBarTintManager;

public class PortalActivity extends BaseActivity {
	private Handler mHandler = new Handler();
	private boolean canExit = false;
	private boolean flag = false;
	private boolean flag2 = false;
	
	private SlidingMenuManage mSlidingMenuManage;
	private TopToolsBarManager mTopToolsBarManager;
	private BottomTabBarManager mBottomTabBarManager;
	
	private BroadcastReceiver mReceiver = new BroadcastReceiver() {
		@Override
		public void onReceive(Context context, Intent intent) {
			if(intent.getAction().equals(Const.SHOPPING_CART_CHANGED)) {
				mTopToolsBarManager.refreshShoppingCartNum();
			}
			else if(intent.getAction().equals(Const.LOGIN_STATUS_CHANGED)) {
				if(mSlidingMenuManage != null) {
					mSlidingMenuManage.setByLoginStatus();
				}
				mTopToolsBarManager.refreshShoppingCartNum();
				
				if(AVUser.getCurrentUser() == null) {
					if(mBottomTabBarManager.mCurrentSelectedTab == 1 || mBottomTabBarManager.mCurrentSelectedTab == 2) {
						flag = true;
					}
				} else {
					if(mBottomTabBarManager != null && mBottomTabBarManager.mTabFragmentStore != null) {
						mBottomTabBarManager.mTabFragmentStore.reloadData();
					}
					
					if(mBottomTabBarManager != null && mBottomTabBarManager.mTabFragmentExpress != null) {
						mBottomTabBarManager.mTabFragmentExpress.reloadData();
					}
				}
				
				flag2 = true;
			}
		}
	};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		SystemBarTintManager.setContentView(this, R.layout.portal, getResources().getColor(R.color.green));
		mSlidingMenuManage = new SlidingMenuManage();
		mTopToolsBarManager = new TopToolsBarManager();
		mBottomTabBarManager = new BottomTabBarManager();
		
		IntentFilter filter = new IntentFilter();
		filter.addAction(Const.SHOPPING_CART_CHANGED);
		filter.addAction(Const.LOGIN_STATUS_CHANGED);
		this.registerReceiver(mReceiver, filter);

		//检查更新
		DownloadManager downloadManager=new DownloadManager(this,false,true);
		downloadManager.checkDownload();
	}
	
	@Override
	protected void onNewIntent(Intent intent) {
		super.onNewIntent(intent);
		Log.d("CEXX", "CEXX ---> PortalActivity ---> onNewIntent");
		
		mTopToolsBarManager.reset();
		
		ServerSection selectedSection = UtilTools.getServerSection(getApplication());
		mSlidingMenuManage.mSlidingMenu.closeMenu();
		mSlidingMenuManage.mTvReceiverUptown.setText(
				getResources().getString(R.string.reside_menu_layout_left_receiver_uptown)
				+ selectedSection.getUptown());
		
		if(mBottomTabBarManager != null && mBottomTabBarManager.mTabFragmentHome != null) {
			mBottomTabBarManager.mTabFragmentHome.reloadData();
		}
		
		if(mBottomTabBarManager != null && mBottomTabBarManager.mTabFragmentStore != null) {
			mBottomTabBarManager.mTabFragmentStore.reloadData();
		}
	}
	
	@Override
	protected void onResume() {
		super.onResume();
		mTopToolsBarManager.refreshShoppingCartNum();
		mSlidingMenuManage.setCanScroll(true);
		
		if(flag) {
			flag = false;
			mBottomTabBarManager.tabHomeSelected();
		}
		
		if(flag2) {
			flag2 = false;
			if(mBottomTabBarManager != null && mBottomTabBarManager.mTabFragmentHome != null) {
				Const.mStoreInfoCvs = null;
				if(AVUser.getCurrentUser() != null) {
					RetrieveDataAsyn.getInstance().getStoreInfosForStore(-1, new RetrieveDataListener() {
						@Override
						public void dataRetrieved(int requestId, Object data) {
							if(data != null) {
								Const.mStoreInfoCvs = (StoreInfo) data;
								mBottomTabBarManager.mTabFragmentHome.refreshData();
							}
						}
					});
				} else {
					mBottomTabBarManager.mTabFragmentHome.refreshData();
				}
			}
		}
	}

	@Override
	protected void onDestroy() {
		Log.d("CEXX", "CEXX ---> PortalActivity ---> onDestroy");
		super.onDestroy();
		this.unregisterReceiver(mReceiver);
	}
	
//	@Override
//	public void onRefresh(PullToRefreshBase<ListView> refreshView) {
//		mSlidingMenuManage.setCanScroll(true);
//	}
//	
//	@Override
//	public void onPullEvent(PullToRefreshBase<ListView> refreshView, State state, Mode direction) {
//		Log.d("CEXX", "CEXX ---> PortalActivity ---> onPullEvent ---> state : " + state);
//		if(State.PULL_TO_REFRESH.equals(state)) {
//			mSlidingMenuManage.setCanScroll(false);
//		}
//		else if(State.RESET.equals(state)) {
//			mSlidingMenuManage.setCanScroll(true);
//		}
//	}
	
	@Override
	public boolean onKeyUp(int keyCode, KeyEvent event) {
		switch (keyCode) {
			case KeyEvent.KEYCODE_SEARCH:
				return true;
			case KeyEvent.KEYCODE_BACK:
				// 按回退键
				if (canExit) {
					UtilTools.exit(this);
				} 
				else {
					mHandler.postDelayed(new Runnable() {
						@Override
						public void run() {
							canExit = false;
						}
					}, 2000);
					canExit = true;
					Toast.makeText(this, getString(R.string.main_exit_tip), Toast.LENGTH_SHORT).show();
				}
				return true;
		}
		
		return super.onKeyUp(keyCode, event);
	}
	
	private class SlidingMenuManage implements OnClickListener{
		private SlidingMenu mSlidingMenu;
		private TextView mTvLoginedDes;
		private TextView mTvReceiverUptown;
		private TextView mTvPhone;
		private Button mBtnLogin;
		private View mPhoneIcon;
		private View mUserIcon;
		private View mItemReceiverUptown;
		private View mItemMyOrder;
		private View mItemMyMessage;
		private View mItemMyStore;
		private View mItemCommence;
		private View mItemSetting;
		
		public SlidingMenuManage() {
			mSlidingMenu = (SlidingMenu)findViewById(R.id.id_menu);
			mTvLoginedDes = (TextView)findViewById(R.id.left_menu_logined_des);
			mTvReceiverUptown = (TextView)findViewById(R.id.left_menu_receiver_uptown);
			mTvPhone = (TextView)findViewById(R.id.left_menu_contact_phone);
			
			mBtnLogin = (Button)findViewById(R.id.left_menu_login);
			mPhoneIcon = findViewById(R.id.left_menu_contact_phone_icon);
			mUserIcon = findViewById(R.id.left_menu_header_icon);
			mItemReceiverUptown = findViewById(R.id.left_menu_receiver_uptown_rl);
			mItemMyOrder = findViewById(R.id.left_menu_item_my_order);
			mItemMyMessage = findViewById(R.id.left_menu_item_my_message);
			mItemMyStore = findViewById(R.id.left_menu_item_my_store);
			mItemCommence = findViewById(R.id.left_menu_item_commences);
			mItemSetting = findViewById(R.id.left_menu_item_setting);
			
			mBtnLogin.setOnClickListener(this);
			mPhoneIcon.setOnClickListener(this);
			mUserIcon.setOnClickListener(this);
			mItemReceiverUptown.setOnClickListener(this);
			mItemMyOrder.setOnClickListener(this);
			mItemMyMessage.setOnClickListener(this);
			mItemMyStore.setOnClickListener(this);
			mItemCommence.setOnClickListener(this);
			mItemSetting.setOnClickListener(this);
			
			this.setByLoginStatus();
			ServerSection selectedSection = UtilTools.getServerSection(getApplication());
			mTvReceiverUptown.setText(
					getResources().getString(R.string.reside_menu_layout_left_receiver_uptown)
					+ selectedSection.getUptown());
			
			if(AntHomeApplication.serviePhone == null) {
				RetrieveDataAsyn.getInstance().getServiePhone(-1, new RetrieveDataListener() {
					@Override
					public void dataRetrieved(int requestId, Object data) {
						Log.d("CEXX", "CEXX ---> ServiePhone ---> data : " + data);
						if(data != null) {
							ServiePhone serviePhone = (ServiePhone)data;
							AntHomeApplication.serviePhone = serviePhone;
							mTvPhone.setText(getResources().getString(R.string.reside_menu_layout_left_phone) 
									+ serviePhone.getPhone());
							Log.d("CEXX", "CEXX ---> ServiePhone ---> phone : " + serviePhone.getPhone());
						}
					}
				});
			}
			else {
				mTvPhone.setText(getResources().getString(R.string.reside_menu_layout_left_phone)
						+ AntHomeApplication.serviePhone.getPhone());
			}
		}
		
		public void setCanScroll(boolean can) {
			mSlidingMenu.setCanScroll(can);
		}
		
		public void toggleMenu(View view)
		{
			mSlidingMenu.toggle();
		}
		
		public void setByLoginStatus() {
			AVUser avUser = AVUser.getCurrentUser();
			if(avUser == null) {
				mTvLoginedDes.setVisibility(View.GONE);
				mBtnLogin.setVisibility(View.VISIBLE);
				mTvLoginedDes.setText("");
			}
			else {
				mTvLoginedDes.setVisibility(View.VISIBLE);
				mBtnLogin.setVisibility(View.GONE);
				String phone = avUser.getMobilePhoneNumber();
				
				if(!TextUtils.isEmpty(phone)) {
					String str0 = "";
					String str1 = "";
					try{
						str0 = phone.substring(0, 3);
						str1 = phone.substring(7);
					}catch(Exception e) {
						e.printStackTrace();
					}
					
					phone = str0 + "****" + str1;
					mTvLoginedDes.setText(phone);
				}
			}
		}

		@Override
		public void onClick(View v) {
			if(v.equals(mBtnLogin)) {
				Intent intent = new Intent(PortalActivity.this, LoginActivity.class);
	            startActivity(intent);  
			}
			else if(v.equals(mPhoneIcon)) {
				ServiePhone sPhone = AntHomeApplication.serviePhone;
				if(sPhone != null) {
					String phoneNum = sPhone.getPhone();
					Log.d("CEXX", "CEXX => mPhoneIcon => phoneNum : " + phoneNum);
					if(!TextUtils.isEmpty(phoneNum)) {
						Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNum));
						startActivity(intent);
					}
				}
			}
			else if(v.equals(mUserIcon)) {
				if(UtilTools.isUserLogined(activity)) {
					Intent intent = new Intent(PortalActivity.this, MyInfoActivity.class);
	                startActivity(intent);
				}
			}
			else if(v.equals(mItemReceiverUptown)) {
				if(AVUser.getCurrentUser() == null) {
					mSlidingMenu.closeMenu();
					Intent intent = new Intent(PortalActivity.this, SelectAreaActivity.class);
	                startActivity(intent);
	                return;
				}
				
				
				List<ShoppingCart> scList = UtilTools.getShoppingCartDatas();
				if(scList == null || scList.size() == 0) {
					mSlidingMenu.closeMenu();
					Intent intent = new Intent(PortalActivity.this, SelectAreaActivity.class);
	                startActivity(intent);
	                return;
				}
				
				new SwitchAreaPromptDialog(PortalActivity.this, new BtnClickListener() {
					@Override
					public void btnSureClick() {
						RetrieveDataAsyn.getInstance().clearShoppingCart(
								AVUser.getCurrentUser().getObjectId(), AntHomeApplication.sectionNum);
						mSlidingMenu.closeMenu();
						Intent intent = new Intent(PortalActivity.this, SelectAreaActivity.class);
		                startActivity(intent);
					}
					
					@Override
					public void btnCancelClick() {
						
					}
				}).show();
			}
			else if(v.equals(mItemMyOrder)) {
				if(UtilTools.isUserLogined(activity)) {
					Intent intent = new Intent(PortalActivity.this, MyOrdersActivity.class);
	                startActivity(intent);
				}
			}
			else if(v.equals(mItemMyMessage)) {
				if(UtilTools.isUserLogined(activity)) {
					Intent intent = new Intent(PortalActivity.this, MyMsgActivity.class);
	                startActivity(intent);
				}
			}
			else if(v.equals(mItemMyStore)) {
				if(UtilTools.isUserLogined(activity)) {
					Intent intent = new Intent(PortalActivity.this, MyFavActivity.class);
	                startActivity(intent);
				}
			}
			else if(v.equals(mItemCommence)) {
				if(UtilTools.isUserLogined(activity)) {
					Intent intent = new Intent(PortalActivity.this, EvaluationFeedbackActivity.class);
	                startActivity(intent);
				}
			}
			else if(v.equals(mItemSetting)) {
//				if(UtilTools.isUserLogined(activity)) {
					Intent intent = new Intent(PortalActivity.this, SettingsActivity.class);
		            startActivity(intent);
//				}
			}
		}
	}
	
	private class TopToolsBarManager implements OnClickListener {
		private View mTopToolsBar;
		private View mMenuToggle;
		private TextView mTvSelectUpTown;
		private TextView mTvShoppingCartNum;
		private View mSearch;
		private View mShopBasket;
		
		public TopToolsBarManager() {
			mTopToolsBar = findViewById(R.id.portal_top_tools_bar);
			mMenuToggle = findViewById(R.id.portal_menu_toggle);
			mTvSelectUpTown = (TextView)findViewById(R.id.portal_select_uptown);
			mTvShoppingCartNum = (TextView)findViewById(R.id.portal_shop_basket_num);
			mShopBasket = findViewById(R.id.portal_shop_basket);
			mSearch = findViewById(R.id.portal_search_rl);
			
			mMenuToggle.setOnClickListener(this);
			mTvSelectUpTown.setOnClickListener(this);
			mSearch.setOnClickListener(this);
			mShopBasket.setOnClickListener(this);
			
			this.reset();
		}
		
		@Override
		public void onClick(View v) {
			if(v.equals(mMenuToggle)) {
				mSlidingMenuManage.toggleMenu(mMenuToggle);
			}
			else if(v.equals(mTvSelectUpTown)) {
				mSlidingMenuManage.toggleMenu(mMenuToggle);
			}
			else if(v.equals(mSearch)) {
				Intent intent = new Intent(PortalActivity.this, SearchActivity.class);
				startActivity(intent);
			}
			else if(v.equals(mShopBasket)) {
				if(AVUser.getCurrentUser() == null) {
					Intent intent = new Intent(PortalActivity.this, LoginActivity.class);
					startActivity(intent);
				}
				else {
					Intent intent = new Intent(PortalActivity.this, ShoppingCartActivity.class);
					startActivity(intent);
				}
			}
		}
		
		public void reset() {
			ServerSection selectedSection = UtilTools.getServerSection(getApplication());
			mTvSelectUpTown.setText(selectedSection.getUptown());
		}
		
		public void refreshShoppingCartNum() {
			int size = UtilTools.getShoppingCartDatas().size();
			if(size == 0) {
				mTvShoppingCartNum.setVisibility(View.GONE);
			}
			else {
				mTvShoppingCartNum.setVisibility(View.VISIBLE);
			}
			mTvShoppingCartNum.setText(String.valueOf(size));
		}
	}
	
	private class BottomTabBarManager implements OnClickListener{
		private View mTabHome;
		private View mTabStore;
		private View mTabExpressDelivery;
		private View mTabMe;
		private ImageView mTabHomeIcon;
		private ImageView mTabStoreIcon;
		private ImageView mTabExpressIcon;
		private ImageView mTabMeIcon;
		private TextView mTabHomeDes;
		private TextView mTabStoreDes;
		private TextView mTabExpressDes;
		private TextView mTabMeDes;
		
		/**
		 * 0：home；1：store；2：express；3：me
		 */
		private int mCurrentSelectedTab = -1;
		
		private FragmentManager mFragmentManager;
		private Fragment mCurVisibleFragment;
		private TabFragmentHome mTabFragmentHome;
		private TabFragmentStore mTabFragmentStore;
		private TabFragmentExpress mTabFragmentExpress;
		
		public BottomTabBarManager() {
			mTabHome = findViewById(R.id.portal_tab_home);
			mTabStore = findViewById(R.id.portal_tab_store);
			mTabExpressDelivery = findViewById(R.id.portal_tab_express_delivery);
			mTabMe = findViewById(R.id.portal_tab_personal);
			mTabHomeIcon = (ImageView)findViewById(R.id.portal_tab_home_iv);
			mTabStoreIcon = (ImageView)findViewById(R.id.portal_tab_store_iv);
			mTabExpressIcon = (ImageView)findViewById(R.id.portal_tab_express_iv);
			mTabMeIcon = (ImageView)findViewById(R.id.portal_tab_me_iv);
			mTabHomeDes = (TextView)findViewById(R.id.portal_tab_home_tv);
			mTabStoreDes = (TextView)findViewById(R.id.portal_tab_store_tv);
			mTabExpressDes = (TextView)findViewById(R.id.portal_tab_express_tv);
			mTabMeDes = (TextView)findViewById(R.id.portal_tab_me_tv);
			
			mTabHome.setOnClickListener(this);
			mTabStore.setOnClickListener(this);
			mTabExpressDelivery.setOnClickListener(this);
			mTabMe.setOnClickListener(this);
			
			mFragmentManager = getFragmentManager();
			tabHomeSelected();
		}

		@Override
		public void onClick(View v) {
			if(v.equals(mTabHome)) {
				this.tabHomeSelected();
			}
			else if(v.equals(mTabStore)) {
				if(AVUser.getCurrentUser() == null) {
					Intent intent = new Intent(PortalActivity.this, LoginActivity.class);
					startActivity(intent);
				}
				else {
					this.tabStoreSelected();
				}
			}
			else if(v.equals(mTabExpressDelivery)) {
				if(AVUser.getCurrentUser() == null) {
					Intent intent = new Intent(PortalActivity.this, LoginActivity.class);
					startActivity(intent);
				}
				else {
					this.tabExpressSelected();
				}
			}
			else if(v.equals(mTabMe)) {
				this.tabMeSelected();
			}
		}
		
		public void tabHomeSelected() {
			Log.d("CEXX", "CEXX => tabHomeSelected => mCurrentSelectedTab : " + mCurrentSelectedTab);
			if(mCurrentSelectedTab == 0) {
				return;
			}
			mCurrentSelectedTab = 0;
			
			mTabHomeIcon.setImageResource(R.drawable.tab_home_selected);
			mTabStoreIcon.setImageResource(R.drawable.tab_supermarket_default);
			mTabExpressIcon.setImageResource(R.drawable.tab_express_default);
			mTabMeIcon.setImageResource(R.drawable.tab_me_default);
			mTabHomeDes.setTextColor(getResources().getColor(R.color.green));
			mTabStoreDes.setTextColor(getResources().getColor(android.R.color.darker_gray));
			mTabExpressDes.setTextColor(getResources().getColor(android.R.color.darker_gray));
			mTabMeDes.setTextColor(getResources().getColor(android.R.color.darker_gray));
			
			try
	        {
	            FragmentTransaction transaction = mFragmentManager.beginTransaction();
	            
	            if(mCurVisibleFragment != null && mCurVisibleFragment.isVisible())
	            {
	                transaction.hide(mCurVisibleFragment);
	            }
	            
	            if (mTabFragmentHome == null)
	            {
	            	mTabFragmentHome = new TabFragmentHome();
	                transaction.add(R.id.portal_fragment_container, mTabFragmentHome);
	            }
	            else
	            {
	                transaction.show(mTabFragmentHome);
	            }
	            transaction.commit();
	            mCurVisibleFragment = mTabFragmentHome;
	        } catch (Exception e)
	        {
	            e.printStackTrace();
	        }
		}
		
		public void tabStoreSelected() {
			Log.d("CEXX", "CEXX => tabStoreSelected => mCurrentSelectedTab : " + mCurrentSelectedTab);
			if(mCurrentSelectedTab == 1) {
				return;
			}
			mCurrentSelectedTab = 1;
			
			mTabHomeIcon.setImageResource(R.drawable.tab_home_default);
			mTabStoreIcon.setImageResource(R.drawable.tab_supermarket_selected);
			mTabExpressIcon.setImageResource(R.drawable.tab_express_default);
			mTabMeIcon.setImageResource(R.drawable.tab_me_default);
			mTabHomeDes.setTextColor(getResources().getColor(android.R.color.darker_gray));
			mTabStoreDes.setTextColor(getResources().getColor(R.color.green));
			mTabExpressDes.setTextColor(getResources().getColor(android.R.color.darker_gray));
			mTabMeDes.setTextColor(getResources().getColor(android.R.color.darker_gray));
			
			try
	        {
	            FragmentTransaction transaction = mFragmentManager.beginTransaction();
	            
	            if(mCurVisibleFragment != null && mCurVisibleFragment.isVisible())
	            {
	                transaction.hide(mCurVisibleFragment);
	            }
	            
	            if (mTabFragmentStore == null)
	            {
	            	mTabFragmentStore = new TabFragmentStore();
	                transaction.add(R.id.portal_fragment_container, mTabFragmentStore);
	            }
	            else
	            {
	                transaction.show(mTabFragmentStore);
	            }
	            transaction.commit();
	            mCurVisibleFragment = mTabFragmentStore;
	        } catch (Exception e)
	        {
	            e.printStackTrace();
	        }
		}
		
		public void tabExpressSelected() {
			Log.d("CEXX", "CEXX => tabExpressSelected => mCurrentSelectedTab : " + mCurrentSelectedTab);
			if(mCurrentSelectedTab == 2) {
				return;
			}
			mCurrentSelectedTab = 2;
			
			mTabHomeIcon.setImageResource(R.drawable.tab_home_default);
			mTabStoreIcon.setImageResource(R.drawable.tab_supermarket_default);
			mTabExpressIcon.setImageResource(R.drawable.tab_express_selected);
			mTabMeIcon.setImageResource(R.drawable.tab_me_default);
			mTabHomeDes.setTextColor(getResources().getColor(android.R.color.darker_gray));
			mTabStoreDes.setTextColor(getResources().getColor(android.R.color.darker_gray));
			mTabExpressDes.setTextColor(getResources().getColor(R.color.green));
			mTabMeDes.setTextColor(getResources().getColor(android.R.color.darker_gray));
			
			try
	        {
	            FragmentTransaction transaction = mFragmentManager.beginTransaction();
	            
	            if(mCurVisibleFragment != null && mCurVisibleFragment.isVisible())
	            {
	                transaction.hide(mCurVisibleFragment);
	            }
	            
	            if (mTabFragmentExpress == null)
	            {
	            	mTabFragmentExpress = new TabFragmentExpress();
	                transaction.add(R.id.portal_fragment_container, mTabFragmentExpress);
	            }
	            else
	            {
	                transaction.show(mTabFragmentExpress);
	            }
	            transaction.commit();
	            mCurVisibleFragment = mTabFragmentExpress;
	        } catch (Exception e)
	        {
	            e.printStackTrace();
	        }
		}
		
		public void tabMeSelected() {
			Log.d("CEXX", "CEXX => tabMeSelected => mCurrentSelectedTab : " + mCurrentSelectedTab);
//			if(mCurrentSelectedTab == 3) {
//				return;
//			}
//			mCurrentSelectedTab = 3;
//			
//			mTabHomeIcon.setImageResource(R.drawable.tab_home_default);
//			mTabStoreIcon.setImageResource(R.drawable.tab_supermarket_default);
//			mTabExpressIcon.setImageResource(R.drawable.tab_express_default);
//			mTabMeIcon.setImageResource(R.drawable.tab_me_selected);
//			mTabHomeDes.setTextColor(getResources().getColor(android.R.color.darker_gray));
//			mTabStoreDes.setTextColor(getResources().getColor(android.R.color.darker_gray));
//			mTabExpressDes.setTextColor(getResources().getColor(android.R.color.darker_gray));
//			mTabMeDes.setTextColor(getResources().getColor(R.color.green));
			
			mSlidingMenuManage.toggleMenu(mTabMe);
		}
	}
}
